Skip to content

C# 14: User increment/decrement support.#21827

Draft
michaelnebel wants to merge 11 commits into
github:mainfrom
michaelnebel:csharp14/userincrementdecrement
Draft

C# 14: User increment/decrement support.#21827
michaelnebel wants to merge 11 commits into
github:mainfrom
michaelnebel:csharp14/userincrementdecrement

Conversation

@michaelnebel
Copy link
Copy Markdown
Contributor

@michaelnebel michaelnebel commented May 11, 2026

In this PR we add support for user defined instance decrement/increment operators.

Example:

public class C
{
    public int Value { get; private set; }

    public C(int value)
    {
        Value = value;
    }

    public void operator ++()
    {
        Value++;
    }
}

Similar to user defined compound assignment operators, the increment/decrement operators manipulates the instance they are applied to. This requires changes to the dispatch logic for such operator calls.

@github-actions github-actions Bot added the C# label May 11, 2026
@michaelnebel michaelnebel force-pushed the csharp14/userincrementdecrement branch from e93876d to dab1525 Compare May 12, 2026 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant